using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Acms.WebControls
{
    [PersistChildren(true)]
    [ParseChildren(false)]
    [ToolboxData("<{0}:DoubleColumn runat=server></{0}:DoubleColumn>")]
    [Designer(typeof(DoubleColumnDesigner))]
    public class DoubleColumn : BaseColumn
    {
        protected override string GetClass()
        {
            return "DoubleColumn";
        }

        internal override int GetColumnWidth()
        {
            return 2;
        }

        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            if (this.Parent is Columns)
            {
                int width = GetColumnWidth() * 100 / ((Columns)this.Parent).NoOfColumns;
                writer.AddStyleAttribute(HtmlTextWriterStyle.Width, string.Concat(width, "%"));
            }
            base.AddAttributesToRender(writer);
        }
    }

    public class DoubleColumnDesigner : BaseColumnDesigner
    {
        public override string FrameCaption
        {
            get { return "Acms Double Width Column"; }
        }
    }
}
